Bug fixes and test files for PR-535 (SQL keyword detection)#1
Merged
Conversation
The isVariableContext() function was incorrectly treating ALL keywords
followed by '(' as variables, which broke normal control flow statements
like if (condition), dou (condition), and elseif (condition).
This fix now only treats a keyword followed by '(' as a variable if it's
also preceded by operators like '.', '(', or ',' that indicate it's being
used as a value in an expression.
Examples that now work correctly:
- if (condition) → KEYWORD (control flow)
- foo(end) → VARIABLE (end is function parameter)
- arr(if) → VARIABLE (if is array subscript)
- ds.end(x) → VARIABLE (end is DS field)
Fixes the ENDIF/ENDDO/ELSE highlighting errors in debug mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds bug fixes documentation and comprehensive test files for the SQL keyword detection enhancements in PR codefori#535.
What's included:
PR-535-Bug-Fixes.md- Detailed documentation of additional bug fixes found during testingPR-535-Testing-Guide.md- Comprehensive testing guide with all test scenariostest_dcl_blocks.rpgle- DCL block handlingtest_end_free_issue.rpgle- END statement issuestest_endproc_issue.rpgle- ENDPROC handlingtest_mismatched_blocks.rpgle- Mismatched block detectiontest_pr535_sql_keywords.rpgle- SQL keyword scenariostest_variable_named_keywords.rpgle- Variables with keyword namesASKDATE.RPGLE- Additional test caseThese changes complement your original PR and help ensure the SQL keyword detection works correctly across all scenarios.
For the PR codefori#535 author
Please review and merge these commits into your
fixErrorHighlightbranch so they become part of PR codefori#535 on codefori/vscode-rpgle.